package cn.com.connext.scrm.repository.master;


import cn.com.connext.scrm.domain.master.ClickCount;
import cn.com.connext.scrm.domain.master.TmpMsgRecord;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.List;


@Repository
public interface ClickCountRepository extends JpaRepository<ClickCount, String>, JpaSpecificationExecutor {

    @Query(value = "SELECT * FROM click_count  WHERE  activity_id = :activityId and union_id = :unionId ", nativeQuery = true)
    ClickCount findByActivityIdAndUnionId(@Param("activityId")String activityId, @Param("unionId")String unionId);
    @Query(value = "UPDATE click_count  SET count = 0", nativeQuery = true)
    void clearClickCount();
}
